package org.agile2soft.nexoma.core.dao.hibernate;

import java.util.List;

import org.agile2soft.nexoma.core.dao.ProfileDAO;
import org.agile2soft.nexoma.core.entity.Profile;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

import br.com.arsmachina.dao.hibernate.GenericDAOImpl;

public class ProfileDAOImpl extends GenericDAOImpl <Profile,Integer> implements ProfileDAO {

    public ProfileDAOImpl(SessionFactory sessionFactory) {
        super(sessionFactory);
    }

    @SuppressWarnings("unchecked")
    public List<Profile> findByName(String name) {
        return getSession().createCriteria(Profile.class)
                          .add(Restrictions.eq("name", name))
                           .list();
    }

}
